<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>订阅申请</span>
      </div>
      <el-form label-width="80px">
        <el-form-item label="用途">
          <el-input v-model="form.purpose"></el-input>
        </el-form-item>
        <el-form-item label="申请理由">
          <el-input type="textarea" v-model="form.reason" :rows="6"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm">提交</el-button>
          <el-button @click="cancelForm">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        purpose: '',
        reason: ''
      }
    };
  },
  methods: {
    submitForm() {
      console.log('提交表单', this.form);
      this.$emit('submitForm',this.form);
    },
    cancelForm() {
      this.form.purpose = '';
      this.form.reason = '';
      this.$emit('cancelForm');
    }
  }
};
</script>

<style lang="scss" scoped>
.app-container {
  .box-card {
    width: 500px;
  }
}
</style>